package com.hsmpay.mobile.dao.organization.impl;

import com.hsmpay.common.dao.Impl.BaseDaoSupport;
import com.hsmpay.mobile.dao.organization.OrgTerminalDao;
import com.hsmpay.mobile.pojo.organization.OrgTerminal;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;

/**
 * 机构终端关系 Dao接口
 *
 * @author 颜铃璋
 *         建立时间：2014-3-21
 */
@Repository("orgTerminalDao")
public class OrgTerminalDaoImpl extends BaseDaoSupport<OrgTerminal, Long> implements OrgTerminalDao<OrgTerminal, Long> {
    /**
     * 根据终端号  获得机构ID
     *
     * @param terminalTypeId
     * @param roleId
     * @return
     * @throws SQLException
     */
    public Long getOrganizationId(Long terminalTypeId, Long roleId) throws SQLException {
        OrgTerminal orgTerminal = new OrgTerminal();
        orgTerminal.setTerminalTypeId(terminalTypeId);
        orgTerminal.setRoleId(roleId);
        orgTerminal = searchEntity(orgTerminal);
        return orgTerminal.getOrganizationId();
    }
}
